
@extends('departmentManagement.business.layouts')
@section('style')
    <meta name="_token" content="{{ csrf_token() }}"/>
    <style>
        .business-index-th {
            text-align: center;
            color: #676767;
        }

        .business-index-td {
            text-align: center;
            color: #676767;
        }

        .ico_img {
            width: 90px;
            height: 80px;
            margin-top: -20px;
        }

        .error {
            color: #ff1100;
            display: none;
        }
        .process-index-th{
            text-align: center;
            color: #676767;
        }
        .process-index-td {
            text-align: center;
            color: #676767;
        }
        .title_label {
            color: #595959;
            margin-top: 10%;
            font-size: 15px;
        }

        .ico_img {
            width: 85px;
            height: 80px;
            margin-top: -20px;
        }


        .time{
            display: inline-block;
            position: relative;
            margin: 0px;
            padding: 0px;
            font-size: 16px;
        }
        .time::before {
            content: '';
            position: absolute;
            top: 110px;
            left: 0;
            height: 4px;
            width: 100%;
            margin: 0;
            padding: 0;
            background: #ddd;
        }
        .time::after{
            content: "";
            display: block;
            clear: both;
        }



        .time2{
            display: inline-block;
            position: relative;
            width:75px;
            padding: 0px;
            font-size: 12px;
            margin-bottom: 35px;
        }
        .time2::before {
            content: '';
            position: absolute;
            top: 0px;
            left: 0;
            height: 4px;
            width: 100%;
            margin: 0;
            padding: 0;
            background: #ddd;
            z-index: -1;
        }
        .time2::after{
            content: "";
            display: block;
            clear: both;
        }

        .a_tm_info {
            position: relative;
            font-size:14px;
        }
        .a_tm_info::before {
            content: '';
            position: absolute;
            top: 0;
            left: 135px;
            height: 100%;
            width: 4px;
            background: #ddd;
            z-index: -1;
        }
        .a_tm_info::after{
            content: '';
            display: table;
            clear: both;
        }
        .l_left{
            float: left;
        }
        .l_left p{
            margin: 0;
            padding: 0;
            text-align: right;
        }
        .l_left>div{
            width: 110px;
        }
        .l_right p:first-child{
            font: 16px '微软雅黑';
        }
        .l_green{
            color: rgb(87, 188, 52);
        }
        .l_center{
            width: 55px;
            float: left;
            text-align: center;
        }
        .l_center>i{
            background-color: white;
        }
        .l_right{
            float: left;
        }
        .l_orange{
            color: rgb(255, 144, 16);
        }
        .l_gray{
            color: rgb(181, 181, 181);
        }


        .l_green1{
            font-size: 12px;
            color: rgb(87, 188, 52);
        }
        .l_orange1{
            font-size: 12px;
            color: rgb(255, 144, 16);
        }
        .l_gray1{
            font-size: 12px;
            color: rgb(181, 181, 181);
        }


        .l_quickInformation{
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            width: 200px;
            cursor: pointer;
        }
        .l_content_box{
            width: 200px;
            margin: 0 auto;
        }
        /*竖排文字*/
        .l_top{
            width: 20px;
        }
        .l_shuzhe{
            height:200px;
            -webkit-writing-mode: vertical-lr;
            writing-mode: vertical-lr;
            /*font-size:16px;*/
        }

        .l_shuzhe_shang{
            direction:rtl;
            unicode-bidi:bidi-override;
            width: 22px;
            height: 100px;
        }

        .l_shuzhe_xia{
            /*direction:rtl;
            text-align: left;*/

        }
        .l_heng_shang{
            /*height: 90px;*/
            text-align: start;
        }
        .l_heng_xia{
            position: absolute;
            top: 125px;
            left: 0;
        }
        .time span{
            display: inline-block;
        }
        .time2::before {
            content: '';
            position: absolute;
            top: 0px;
            left: 0;
            height: 4px;
            width: 100%;
            margin: 0;
            padding: 0;
            background: #ddd;
            z-index: 1;
        }
        .time2::after{
            content: "";
            display: block;
            clear: both;
        }

        .l_heng_shang p:nth-child(2){
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            cursor: pointer;
        }
        .l_center_shu{
            position: absolute;
            top: 101px;
            left: 5px;
            z-index: 1;
        }
        .l_adress{
            margin-top: 20px;
            width: 81px;
            white-space: nowrap;
            padding-left: 10px;
        }
        .heng_i{
            position: absolute;
            top: -8px;
            left: 42px;
            background-color: white;
            z-index: 2;
        }
    </style>

    <style>

    .time{
    display: inline-block;
    position: relative;
    margin: 0px;
    padding: 0px;
    font-size: 16px;
    }
    .time::before {
    content: '';
    position: absolute;
    top: 110px;
    left: 0;
    height: 4px;
    width: 100%;
    margin: 0;
    padding: 0;
    background: #ddd;
    z-index: -1;
    }
    .time::after{
    content: "";
    display: block;
    clear: both;
    }



    .time2{
    display: inline-block;
    position: relative;
    /*margin-left: 10px;*/
    padding: 0px;
    font-size: 16px;
    }
    .time2::before {
    content: '';
    position: absolute;
    top: 0px;
    left: 0;
    height: 4px;
    width: 100%;
    margin: 0;
    padding: 0;
    background: #ddd;
    z-index: -1;
    }
    .time2::after{
    content: "";
    display: block;
    clear: both;
    }

    .a_tm_info {
    position: relative;
    font-size:14px;
    }
    .a_tm_info::before {
    content: '';
    position: absolute;
    top: 0;
    left: 135px;
    height: 100%;
    width: 4px;
    background: #ddd;
    z-index: -1;
    }
    .a_tm_info::after{
    content: '';
    display: table;
    clear: both;
    }
    .l_left{
    float: left;
    }
    .l_left p{
    margin: 0;
    padding: 0;
    text-align: right;
    }
    .l_left>div{
    width: 110px;
    }
    .l_right p:first-child{
    font: 16px '微软雅黑';
    }
    .l_green{
    color: rgb(87, 188, 52);
    }
    .l_center{
    width: 55px;
    float: left;
    text-align: center;
    }
    .l_center>i{
    background-color: white;
    }
    .l_right{
    float: left;
    }
    .l_orange{
    color: rgb(255, 144, 16);
    }
    .l_gray{
    color: rgb(181, 181, 181);
    }
    .l_quickInformation{
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 200px;
    cursor: pointer;
    }
    .l_content_box{
    width: 400px;
    margin: 0 auto;
    }
    /*竖排文字*/
    .l_top{
    width: 20px;
    }
    .l_shuzhe{
    height:200px;
    -webkit-writing-mode: vertical-lr;
    writing-mode: vertical-lr;
    /*font-size:16px;*/
    }

    .l_shuzhe_shang{
    direction:rtl;
    unicode-bidi:bidi-override;
    width: 22px;
    height: 100px;
    }

    .l_shuzhe_xia{
    /*direction:rtl;
    text-align: left;*/

    }
    .l_heng_shang{
    /*height: 90px;*/
    text-align: start;
    }
    .l_heng_xia{
    position: absolute;
    top: 125px;
    left: 0;
    }
    .time span{
    display: inline-block;
    }
    .l_heng_shang p:nth-child(2){
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    }
    .l_center_shu{
    position: absolute;
    top: 101px;
    left: 5px;
    z-index: 1;
    }
    .l_adress{
    margin-top: 20px;
    width: 100px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    }
    .heng_i{
    position: absolute;
    top: -8px;
    left: 42px;
    background-color: white;
    }
    </style>
    <link rel="stylesheet" href="{{asset('admin_assets/css/bootstrap-datetimepicker.min.css')}}">
    <link rel="stylesheet" href="{{asset('admin_assets/css/ip.css')}}">
    <link rel="stylesheet" href="{{url('css/search.css')}}">
    <link rel="stylesheet" href="{{url('css/task.css')}}">
@stop
@section('content')
    <div class="content-wrapper" style="background-color: white">
        <section class="content">
            <div class="row">
                <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                    <div class="box box-info"
                         style="padding-top: 0px;margin-top: 0px;border-top: 0px;border-bottom: solid 1px #0080ff;">
                        <div class="box-body" style="">
                            <div class="row">
                                <div class="col-lg-2 col-md-2 col-sm-12 col-xs-12" style="margin-top: 0.5vw">
                                    <a href="#" title="返回首页" style="float: left"><i class="fa fa-home fa-2x"
                                                                                    style="width: 100%;color: #0080FF">
                                        </i></a>
                                    <a href="{{url('management/business/index')}}"><span
                                                style="font-size: 18px;float: left;margin-top: 5px">&nbsp;首页</span></a>
                                    <div class="clear"></div>
                                </div>
                                {{--<div class="col-lg-2 col-md-2 col-sm-12 col-xs-12  col-lg-offset-8 col-md-offset-8">--}}
                                    {{--<form action="{{url('management/business/indexSearch')}}" method="post"--}}
                                          {{--enctype="multipart/form-data" class="search">--}}
                                        {{--{{csrf_field()}}--}}
                                        {{--<input type="search" id="search-input" name="search">--}}
                                        {{--<button class="fa fa-search fa-lg"></button>--}}
                                    {{--</form>--}}
                                {{--</div>--}}
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-lg-3 col-md-4 col-sm-6 col-xs-6">
                    <div class="small-box bg-aqua">
                        <div class="inner">
                            <h3>{{$tab['businessNum']}}</h3>
                            <p>业务总数</p>
                        </div>
                        <div class="icon">
                            <img class="ico_img" src="{{asset('admin_assets/img/total_icon.png')}}">
                        </div>
                    </div>
                </div>
                <div class="col-lg-3 col-md-4 col-sm-6 col-xs-6">
                    <div class="small-box bg-green">
                        <div class="inner">
                            <h3>{{$tab['businessFile']}}</h3>
                            <p>待上传资料</p>
                        </div>
                        <div class="icon">
                            <img class="ico_img" src="{{asset('admin_assets/img/upload_data_icon.png')}}">
                        </div>
                    </div>
                </div>
                <div class="col-lg-3 col-md-4 col-sm-6 col-xs-6">
                    <a href="{{url('management/business/applyNotice')}}">
                        <div class="small-box bg-yellow">
                            <div class="inner">
                                <h3>{{$tab['businessReplyNum']}}</h3>
                                <p>申请通知书</p>
                            </div>
                            <div class="icon">
                                <img class="ico_img" src="{{asset('admin_assets/img/application_notice_icon.png')}}">
                            </div>
                        </div>
                    </a>
                </div>
                <div class="col-lg-3 col-md-4 col-sm-6 col-xs-6">
                    <div class="small-box bg-green-gradient">
                        <div class="inner">
                            <h3>{{$tab['businessUnsettled']}}</h3>
                            <p>待结算</p>
                        </div>
                        <div class="icon">
                            <img class="ico_img" src="{{asset('admin_assets/img/dealing_icon.png')}}">
                        </div>
                    </div>
                </div>
                <div class="col-lg-3 col-md-4 col-sm-6 col-xs-6">
                    <div class="small-box bg-red">
                        <div class="inner">
                            <h3>{{$tab['businessTailPayment']}}</h3>
                            <p>尾款需结算</p>
                        </div>
                        <div class="icon">
                            <img class="ico_img" src="{{asset('admin_assets/img/press_money_icon.png')}}">
                        </div>
                    </div>
                </div>
                <div class="col-lg-3 col-md-4 col-sm-6 col-xs-6">
                    <div class="small-box bg-teal-gradient">
                        <div class="inner">
                            <h3>{{$tab['businessFinish']}}</h3>
                            <p>已结单数</p>
                        </div>
                        <div class="icon">
                            <img class="ico_img" src="{{asset('admin_assets/img/finish_icon.png')}}">
                        </div>
                    </div>
                </div>
            </div>
            @include('public/alert')
            <div class="row" style="margin-left: 10px">
                <form class="form-inline" action="{{url('management/business/indexCertainSearch')}}" method="post"
                      enctype="multipart/form-data">
                    {{csrf_field()}}
                    <div class="form-group">
                        <label for="exampleInputEmail2">公司</label>
                        <input type="text" class="form-control" name="company" id="exampleInputEmail2" placeholder="公司">
                    </div>
                    <label for="exampleInputName2">任务类型</label>
                    <select class="form-control" name="is_renew">
                        <option value=" " >不填</option>
                        <option value="0" >首次任务</option>
                        <option value="1" >续费任务</option>
                    </select>
                    <label for="exampleInputName2">类型</label>
                    <select class="form-control" name="first_type">
                        <option value=" " >不填</option>
                        <option value="1" >专利</option>
                        <option value="2" >商标</option>
                        <option value="3" >版权</option>
                        <option value="4" >项目</option>
                    </select>
                    <div class="form-group">
                        <label for="exampleInputName2">申请人</label>
                        <input type="text" class="form-control" name="applicant" id="exampleInputName2" placeholder="申请人">
                    </div>
                    <div class="form-group">
                        <label for="exampleInputEmail2">电话</label>
                        <input type="text" class="form-control" name="number" id="exampleInputEmail2" placeholder="电话">
                    </div>
                    <div class="form-group">
                        <label for="exampleInputName2">申请日期</label>
                        <input type="date" name="created_at" class="form-control" id="exampleInputName2" >
                    </div>
                    <button type="submit" class="btn btn-default">搜索</button>
                </form>
            </div>
            <div class="row">
                <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
                    <div class="table-responsive">
                        <table class="table table-bordered">
                            <thead>
                            <tr>
                                <th class="business-index-th">编号</th>
                                <th class="business-index-th">公司</th>
                                <th class="business-index-th">任务类别</th>
                                <th class="business-index-th">类型</th>
                                <th class="business-index-th">申请人</th>
                                <th class="business-index-th">联系电话</th>
                                <th class="business-index-th">合同状态</th>
                                <th class="business-index-th">申请日期</th>
                                <th class="business-index-th">款项金额</th>
                                <th class="business-index-th">首款金额</th>
                                <th class="business-index-th">尾款金额</th>
                                <th class="business-index-th">尾款支付时间</th>
                                <th class="business-index-th">进度</th>
                                <th class="business-index-th">报件资料</th>
                                <th class="business-index-th">操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            @if($product->isEmpty())
                                <tr>
                                    <td class="business-index-td" colspan="12"><h3 align="center">暂无数据</h3></td>
                                </tr>
                            @else
                                @foreach($product as $k =>$v)
                                    @php($item=$v['Product'])
                                    <tr>
                                        <td class="business-index-td">{{$k+1}}</td>
                                        <td class="business-index-td">{{$item['company']}}</td>
                                        <td class="business-index-td">
                                            @if($v['is_renew']==0)
                                                首次任务
                                            @else
                                                续费任务
                                            @endif
                                        </td>
                                        <td class="business-index-td">{{$v['FirstType']['name']}}</td>
                                        <td class="business-index-td">{{$item['applicant']}}</td>
                                        <td class="business-index-td">{{$item['phone']}}</td>
                                        <td class="business-index-td">{{$api_data[$k]['msg']}}</td>
                                        <td class="business-index-td">{{date("Y-m-d",strtotime($v['created_at']))}}</td>
                                        <td class="business-index-td">
                                            @if(empty($v['price'])&&$v['price']!="0")
                                                暂未设置
                                            @else
                                                ¥{{$v['price']}}
                                            @endif
                                        </td>
                                        <td class="business-index-td">
                                            @if(empty($v['first_payment'])&&$v['first_payment']!="0")
                                                暂未设置
                                            @else
                                                ¥{{$v['first_payment']}}
                                            @endif
                                        </td>
                                        <td class="business-index-td">
                                            @if(empty($v['tail_payment'])&&$v['tail_payment']!="0")
                                                暂未设置
                                            @else
                                                ¥{{$v['tail_payment']}}
                                            @endif
                                        </td>

                                        <td class="business-index-td">
                                            @if(empty($v['tail_pay_time']))
                                                暂未支付
                                                @if($v['urge']==1)
                                                    <small class="label pull-right bg-red">催</small>
                                                @endif
                                            @else
                                                {{date("Y-m-d",strtotime($v['tail_pay_time']))}}
                                            @endif
                                        </td>
                                        <td class="business-index-td task_flow"

                                            data-toggle="modal"
                                            data-target="#task_flowModal"
                                            data-pid="{{$v['product_id']}}"
                                            data-progressid="{{$v['id']}}"
                                            data-second_type_id="{{$v['second_type_id']}}"


                                        >
                                            @if($v['claim_state']==2||$v['claim_state']==3)
                                                已转接
                                            @else
                                                {{config('config.operation_progress.business')[$v['business_state']]}}
                                            @endif
                                        </td>
                                        <td class="business-index-td">
                                            @if(empty($item['file']))
                                                未上传
                                            @else
                                                <a href="{{asset('Uploads/resources/'.$item['file'])}}">资料审阅</a>
                                            @endif
                                        </td>
                                        <td class="business-index-td">

                                            @if(empty($v['contract_id']))

                                                <a href="#" id="myTransId{{$k}}" id_shift="{{$v['id']}}" conId_shift="{{$v['contract_id']}}"
                                                   onclick="tarnsId({{$k}})" type="button"
                                                   data-toggle="modal" data-target="#myModal">
                                                    设置合同编号
                                                </a>
                                            @else
                                                @if($v['business_state']==$config['wait_set_payment'])
                                                    <a href="#" id="myTransId{{$k}}" id_shift="{{$v['id']}}" conId_shift="{{$v['contract_id']}}"
                                                       onclick="tarnsId({{$k}})" type="button"
                                                       data-toggle="modal" data-target="#myModal" style="width: 6vw;height: 20px;font-size: 8px;border: none;background: transparent">
                                                        修改合同编号
                                                    </a>
                                                @else
                                                    <span href="#">合同编号</span>
                                                @endif

                                            @endif


                                            @if($api_data[$k]['code']==13)
                                                @if($v['is_cancel']==$cancel['cancel'])
                                                    用户已取消
                                                @else
                                                    @if($v['business_state']==$config['waiting_process'])
                                                        <a href="{{url('management/process/productDetail',['id'=>$item['id']])}}"
                                                           target="_blank">查看详情</a><br>


                                                    @elseif($v['business_state']==$config['wait_set_payment'])
                                                        <a href="{{url('management/process/productDetail',['id'=>$item['id']])}}"
                                                           target="_blank">查看详情</a>
                                                        @if($api_data[$k]['code']==13)
                                                            <a href="#" rel="{{$item['id']}}" p="{{$v['id']}}"
                                                               onclick="setId($(this));" data-toggle="modal"
                                                               data-target="#modal-make-money">设置款项</a>
                                                        @endif
                                                        <span href="#">转接</span>

                                                    @elseif($v['business_state']==$config['unliquidated'])
                                                        <a href="{{url('management/process/productDetail',['id'=>$item['id']])}}"
                                                           target="_blank">查看详情</a>
                                                        <a href="#" rel="{{$item['id']}}" p="{{$v['id']}}"
                                                           f="{{$v['first_payment']}}" t="{{$v['price']}}"
                                                           e="{{$v['tail_payment']}}" onclick="setV($(this))"
                                                           data-toggle="modal" data-target="#modal-make-money">修改款项</a>
                                                        <span href="#">转接</span>

                                                    @elseif($v['business_state']==$config['first_pay_no_upload'])
                                                        <a href="{{url('management/process/productDetail',['id'=>$item['id']])}}"
                                                           target="_blank">查看详情</a>
                                                        <span href="#">设置款项</span>
                                                        <span href="#">转接</span>
                                                    @elseif($v['business_state']==$config['first_pay_upload'])

                                                        <a href="{{url('management/process/productDetail',['id'=>$item['id']])}}"
                                                           target="_blank">查看详情</a>
                                                        <span href="#">设置款项</span>
                                                        <a href="{{url('management/business/transfer',['id'=>$v['id']])}}">转接</a>

                                                    @endif
                                                @endif

                                            @else



                                            @endif




                                        </td>
                                    </tr>
                                @endforeach
                            @endif
                            </tbody>
                        </table>
                        <div class="">
                            {!! $product->links() !!}
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </div>
    <!--模态框 -->
    {{--<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">--}}
        {{--<div class="modal-dialog" role="document">--}}
            {{--<div class="modal-content">--}}
                {{--<div class="modal-header">--}}
                    {{--<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>--}}
                    {{--<h4 class="modal-title" id="myModalLabel">Modal title</h4>--}}
                {{--</div>--}}
                {{--<form action="{{url('management/business/editContractId')}}" method="post">--}}
                    {{--{{csrf_field()}}--}}
                    {{--<input type="text" name="id" id="progress_id" style="">--}}
                    {{--合同编号<input type="text" name="contractId" id="con_id">--}}
                    {{--<button type="submit" class="btn btn-primary">保存修改</button>--}}
                {{--</form>--}}
                {{--<div class="modal-footer">--}}
                    {{--<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>--}}
                {{--</div>--}}
            {{--</div>--}}
        {{--</div>--}}
    {{--</div>--}}

    <div class="modal fade" id="myModal" style="">
        <div class="modal-dialog">
            <form action="{{url('management/business/editContractId')}}" method="post" enctype="multipart/form-data" onsubmit="return checkSbt();">
                {{ csrf_field() }}
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true">&times;</span></button>
                        <h3 class="modal-title" style="text-align: center">合同编号</h3>
                    </div>
                    <div class="modal-body">
                        <input type="hidden" name="id" id="progress_id" style="">
                        <div class="row" style="margin-top: 2%">
                            <div class="col-lg-8 col-md-8 col-sm-12 col-xs-12 col-lg-offset-2 col-md-offset-2">
                                <input type="text" class="form-control" placeholder="合同编号" name="contractId" id="con_id" style="border-radius: 5px">
                            </div>
                        </div>

                    </div>
                    <div class="modal-footer">
                        <div class="row">
                            <div class="col-lg-8 col-md-8 col-lg-offset-2 col-md-offset-2 ">
                                <button type="submit" class="btn btn-primary" onclick="return onSure()" style="background-color: #0080ff;border: #0080ff;width: 100%">保存修改
                                </button>
                            </div>
                        </div>
                    </div>
                </div>
            </form>
        </div>
    </div>





    @include('public/make-moneyModal')
    @include('public/showProgressListModal')
@stop
@section('javascript')
    <script src="{{asset('admin_assets/js/bootstrap-datetimepicker.min.js')}}"></script>
    <script>
        $(".form_datetime").datetimepicker({
            format: "yyyy-mm-dd hh:ii:ss",
            autoclose: true,
            todayBtn: true,
            minuteStep: 10,
            language: "en"
        });
    </script>
    <script>
        function check(e) {
            return !isNaN(e);
        }

        function checkSbt() {
            var t = $('#money-total');
            var f = $('#money-first');
            var e = $('#money-end');
            if (check(t.val()) && check(f.val()) && check(e.val()) && !isContains(t.val()) && !isContains(f.val()) && !isContains(e.val())) {
                return true;
            } else {
                alert('款项填写错误');
                return false;
            }
        }

        $(function () {
            $('#money-first').bind('input propertychange', function () {
                calculate();
                return false;
            });
            $('#money-total').bind('input propertychange', function () {
                calculate();
                minus();
                return false;
            });
            $('#money-end').bind('input propertychange', function () {
                minus();
                return false;
            });
        });

        function minus() {
            var to = $('#money-total');
            var e = $('#money-end');
            var f = $('#money-first');

            if (!check(to.val()) || !check(e.val())) {
                return;
            }
            if (e.val() == '' || isContains(e.val(), '-')) {
                f.val('');
                return;
            }
            if (to == '' || to == 0) {
                f.val('0');
            } else {
                var v = parseFloat(to.val()) - parseFloat(e.val());
                if (isContains(v.toString(), '-')) {
                    v = "款项填写错误";
                }
                f.val(v.toString());
            }
        }

        function isContains(str, substr) {
            return str.indexOf(substr) > -1;
        }

        function calculate() {
            var to = $('#money-total');
            var f = $('#money-first');
            var e = $('#money-end');

            if (!check(to.val()) || !check(f.val())) {
                return;
            }
            if (f.val() == '' || isContains(f.val(), '-')) {
                e.val('');
                return;
            }
            if (to == '' || to == 0) {
                e.val("0");
            } else {
                var v = parseFloat(to.val()) - parseFloat(f.val());
                if (isContains(v.toString(), '-')) {
                    v = "款项填写错误";
                }
                e.val(v.toString());
            }
        }

        function setId(e) {
            $('#product').val(e.attr('rel'));
            $('#progress').val(e.attr('p'));
            $('#money-total').val("");
            $('#money-first').val("");
            $('#money-end').val("");
        }

        function setV(e) {
            $('#product').val(e.attr('rel'));
            $('#progress').val(e.attr('p'));
            $('#money-total').val(e.attr('t'));
            $('#money-first').val(e.attr('f'));
            $('#money-end').val(e.attr('e'));
        }

        function onSure() {
            if(confirm( '是否确定！')==false)
                return  false;
        }
        function tarnsId(key) {
            $("#progress_id").val($("#myTransId"+key).attr('id_shift'));
            $("#con_id").val($("#myTransId"+key).attr('conId_shift'));
        }



        $(".task_flow").click(function () {
            var product_id=$(this).attr("data-pid");
            var progressid=$(this).attr("data-progressid");
            var second_type_id=$(this).attr("data-second_type_id");
            $.ajax({
                url:'{{url('user/operate/getProgressList')}}',
                type: 'post',
                dataType: 'json',
                data: {
                    'pid': product_id,
                    'p_id':progressid,
                    's_id':second_type_id
                },
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')
                },
                success:function (data) {

                    console.log(data);
                    var column=data['column'];
                    var row=data['row'];
                    var e=$('#task_progress1');
                    var e1=$('#task_progress');
                    e.empty();
                    e1.empty();

                    if(column.length){
                        for(var i=0,size=column.length;i<size;i++){

                            var item = column[i];

                            if(item['state']==1){

                                e.append('  <div class="l_content_box">\n' +
                                    '            <div class="a_tm_info" >\n' +
                                    '                <div class="l_left">\n' +
                                    '                    <div>\n' +
                                    '                        <p class="l_orange">'+item['time'].split(' ')[0]+'</p>\n' +
                                    '                        <p class="l_orange">'+item['time'].split(' ')[1]+'</p>\n' +
                                    '                    </div>\n' +
                                    '                </div>\n' +
                                    '                <div class="l_center l_orange" >\n' +
                                    '                    <i class="fa fa-check-circle fa-2x"></i>\n' +
                                    '                </div>\n' +
                                    '                <div class="l_right" style="">\n' +
                                    '                    <div>\n' +
                                    '                        ' +
                                    '                        <p class="l_orange l_quickInformation" title="'+item['operate']+'">'+item['operate']+'</p>\n' +
                                    '                    </div>\n' +
                                    '                </div>\n' +
                                    '            </div>\n' +
                                    '        </div>');


                            }
                          else {
                                e.append('  <div class="l_content_box">\n' +
                                    '            <div class="a_tm_info" >\n' +
                                    '                <div class="l_left">\n' +
                                    '                    <div>\n' +
                                    '                        <p class="l_green">'+item['time'].split(' ')[0]+'</p>\n' +
                                    '                        <p class="l_green">'+item['time'].split(' ')[1]+'</p>\n' +
                                    '                    </div>\n' +
                                    '                </div>\n' +
                                    '                <div class="l_center l_green" >\n' +
                                    '                    <i class="fa fa-check-circle fa-2x"></i>\n' +
                                    '                </div>\n' +
                                    '                <div class="l_right" style="">\n' +
                                    '                    <div>\n' +
                                    '                        ' +
                                    '                        <p class="l_green l_quickInformation" title="'+item['operate']+'">'+item['operate']+'</p>\n' +
                                    '                    </div>\n' +
                                    '                </div>\n' +
                                    '            </div>\n' +
                                    '        </div>');
                          }
//                            else{
//                                e.append('  <div class="l_content_box">\n' +
//                                    '            <div class="a_tm_info" >\n' +
//                                    '                <div class="l_left">\n' +
//                                    '                    <div>\n' +
//                                    '                        <p class="l_gray">'+item['time'].split(' ')[0]+'</p>\n' +
//                                    '                        <p class="l_gray">'+item['time'].split(' ')[1]+'</p>\n' +
//                                    '                    </div>\n' +
//                                    '                </div>\n' +
//                                    '                <div class="l_center l_gray" >\n' +
//                                    '                    <i class="fa fa-check-circle fa-2x"></i>\n' +
//                                    '                </div>\n' +
//                                    '                <div class="l_right" style="">\n' +
//                                    '                    <div>\n' +
//                                    '                        ' +
//                                    '                        <p class="l_gray l_quickInformation" title="'+item['operate']+'">'+item['operate']+'</p>\n' +
//                                    '                    </div>\n' +
//                                    '                </div>\n' +
//                                    '            </div>\n' +
//                                    '        </div>');
//                            }

                        }
                    }else {
                        e.append('<p style="text-align: center">暂无操作进度<p>');
                        //查无数据显示
                    }

                    if(row.length){
                        for(var i=0,size=row.length;i<size;i++){

                            var item = row[i];

                            if(item['state']==1){

                                e1.append('<div class="time2">' +
                                    '      <div class="heng_i"><i class="fa fa-check-circle l_green1"></i></div>' +
                                    '                                        <div class="l_adress l_green1" title="">' +
                                    item['operate'] +
                                    '                                        </div>\n' +
                                    '                                    </div>');


                            }

                            else if(item['state']^row[i-1]['state']){
                                e1.append('<div class="time2">' +
                                    '      <div class="heng_i"><i class="fa fa-check-circle l_orange1"></i></div>' +
                                    '                                        <div class="l_adress l_orange1" title="">' +
                                    item['operate'] +
                                    '                                        </div>\n' +
                                    '                                    </div>');
                            }
                            else{
                                e1.append('<div class="time2">' +
                                    '      <div class="heng_i"><i class="fa fa-check-circle l_gray1"></i></div>' +
                                    '                                        <div class="l_adress l_gray1" title="">' +
                                                                                item['operate'] +
                                    '                                        </div>\n' +
                                    '                                    </div>');
                            }

                        }
                    }else {




                        //查无数据显示
                    }

                }

            });

        });

    </script>
@stop
